<!--#layout("/common/layout.html",{"jsBase":"/js/content/resContentMain/"}){ -->
<div class="layui-row">
    <form id="searchForm" class="layui-form layui-form-pane">
        <input type="hidden" name="mediaType" value="${mediaType}">
        <div class="layui-collapse" lay-filter="condictionCol">
            <div class="layui-colla-item">
                <h2 class="layui-colla-title">查询条件</h2>
                <div class="layui-colla-content layui-show">
                    <div class="layui-row">
                        <div class="layui-form-item">
                            <div class="layui-inline">
                                <label class="layui-form-label">所属模块</label>

                                <div class="layui-input-inline">
                                    <layui:simpleDataSelect name="moduleId"  data="${moduleList}"
                                                            attrId="dictId" attrName="dictValue" laySearch="true" layFilter="moudul" id="moduleId"/>
                                </div>

                                <!--#if(accessType==6){ -->
                                <label class="layui-form-label">省份</label>

                                <div class="layui-input-inline">
                                    <layui:simpleDataSelect name="provinceId"  data="${provinceList}"
                                                            attrId="provId" attrName="provName" laySearch="true" layFilter="colFilter" id="provinceId" />
                                </div>
                                <!--#} -->
                                <label class="layui-form-label" >作者</label>
                                <div class="layui-input-inline">
                                    <select style="width:40%" class="select" name="author" id="author" selectValue="" promtion="请选择" lay-search>
                                        <option value="">请选择</option>
                                    </select>
                                </div>
                                <!--
                                <label class="layui-form-label">栏目</label>

                                <div class="layui-input-inline" id="contentTypes" style="width:228px;height: 38px">

                                </div>
                                -->
                                <label class="layui-form-label">内容标题</label>

                                <div class="layui-input-inline">
                                    <input type="text" name="contentTitle" autocomplete="off" class="layui-input">
                                </div>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <div class="layui-inline">
                                <label class="layui-form-label">栏目</label>
                                <div class="layui-input-inline">
                                    <select style="width:40%" class="select" name="contentType" id="contentType" selectValue="" promtion="请选择" lay-search>
                                        <option value="">请选择</option>
                                    </select>
                                </div>

                                <label class="layui-form-label">标签</label>

                                <div class="layui-input-inline">
                                    <layui:simpleDataSelect name="contentTags"  data="${resTag}"
                                                            attrId="tagName" attrName="tagName" laySearch="true" layFilter="resTag"/>
                                </div>

                                <label class="layui-form-label">是否可用</label>
                                <div class="layui-input-inline">
                                    <select name="contentStatus" lay-verify="">
                                        <option value="">不限制</option>
                                        <option value="0">不可用</option>
                                        <option value="1">可用</option>
                                    </select>
                                </div>

                                <label class="layui-form-label">创建时间</label>
                                <div class="layui-input-inline">
                                    <div class="date-range-pick">
                                        <input type="text" name="createdTimeQuery" autocomplete="off" class="layui-input">
                                    </div>
                                </div>

                                <button style="float: right;" class="layui-btn layui-btn-normal" type="button" id="searchFormSearch">搜索</button>
                            </div>
                        </div>

                    </div>
                </div>
            </div>
        </div>
    </form>
</div>

<div class="layui-btn-group">

    <layui:accessButton function="content.resContentMain.add,content.resContentMain.add1" action="add">增加</layui:accessButton>
    <layui:accessButton function="content.resContentMain.edit,content.resContentMain.edit1" action="edit">编辑</layui:accessButton>
    <layui:accessButton function="content.resContentMain.del,content.resContentMain.del1" action="del">删除</layui:accessButton>
    <layui:accessButton function="contentCommnet.resContentComment.query" action="comment">该资讯的评论</layui:accessButton>
    <!--# if (mediaType==1) { -->
    <button id="table-button-chapter" class="layui-btn layui-btn-primary  ext-toolbar "  data-type="chapter">章节管理</button>
    <!--# } -->
</div>

<table id="resContentMainTable" lay-filter="resContentMainTable"></table>
<!--#} -->
<script>
    var mediaType = ${mediaType};
    layui.use(['index','laydate','form'], function () {
        var index = layui.index,
            laydate = layui.laydate,
            form = layui.form;
        index.init();
        form.on('select(colFilter)', function(data){
            setAuthor(data.value);
            contentType();
        });

        form.on('select(moudul)', function(data){
            contentType();
        });

        setAuthor("${provinceId}");

        function setAuthor(id) {
            $.ajax({
                type: 'POST',
                url: "${ctxPath}/content/resContentMain/getAuthor.json",
                data: {
                    provinceId:id
                },
                dataType:'json',
                success: function(data){
                    $("#author").html("");
                    $("#author").append($("<option>").val("").text("请选择"));
                    $.each(data.data, function(key, val) {
                        var option1 = $("<option>").val(val.customerName).text(val.customerName);
                        $("#author").append(option1);
                    });
                    form.render('select');
                }
            });
        }

        function contentType(){
            var provinceId = $("#provinceId").val();
            var moduleId = $("#moduleId").val();
            if (provinceId!="" && moduleId!="") {
                $.ajax({
                    type: 'POST',
                    url: "${ctxPath}/content/resContentMain/getColumns.json",
                    data: {
                        provinceId:provinceId,
                        moduleId:moduleId
                    },
                    dataType:'json',
                    success: function(data){
                        $("#contentType").html("");
                        $("#contentType").append($("<option>").val("").text("请选择"));
                        $.each(data, function(key, val) {
                            var option1 = $("<option>").val(val.colId).text(val.colName);
                            $("#contentType").append(option1);
                        });
                        form.render('select');
                    }
                });
            }
        }



    });

</script>
